package Q345

import java.util.Stack


fun main(){

}

class Solution {
    fun reverseVowels(s: String): String {
        val ans = StringBuffer()
        val stack = Stack<Char>()
        for (c in s.toCharArray()) if ("aeiouAEIOU".contains(c.toString())) stack.push(c)
        for (c in s.toCharArray()) if ("aeiouAEIOU".contains(c.toString())) ans.append(stack.pop()) else ans.append(c)
        return ans.toString()
    }
}